# -*- coding: utf-8 -*- # This software and supporting documentation are distributed by # Institut Federatif de Recherche 49 # CEA/NeuroSpin, Batiment 145, # 91191 Gif-sur-Yvette cedex # France # # This software is governed by the CeCILL license version 2 under # French law and abiding by the rules of distribution of free software. # You can use, modify and/or redistribute the software under the # terms of the CeCILL license version 2 as circulated by CEA, CNRS # and INRIA at the following URL "http://www.cecill.info". # # As a counterpart to the access to the source code and rights to copy, # modify and redistribute granted by the license, users are provided only # with a limited warranty and the software's author, the holder of the # economic rights, and the successive licensors have only limited # liability. # # In this respect, the user's attention is drawn to the risks associated # with loading, using, modifying and/or developing or reproducing the # software by the user in light of its specific status of free software, # that may mean that it is complicated to manipulate, and that also # therefore means that it is reserved for developers and experienced # professionals having in-depth computer knowledge. Users are therefore # encouraged to load and test the software's suitability as regards their # requirements in conditions enabling the security of their systems and/or # data to be ensured and, more generally, to use and operate it in the # same conditions as regards security. # # The fact that you are presently reading this means that you have had # knowledge of the CeCILL license version 2 and that you accept its terms. from brainvisa.processes import * name = 'Diffusion Bundles Analysis' userLevel = 1 signature=Signature( 'bundles', ReadDiskItem( 'Fascicles bundles', 'Aims bundles' ), 'bundles_transformation', ReadDiskItem( 'Transformation matrix','Transformation matrix' ), 'minimum_length', Float(), 'slices', Integer(), 'apparent_diffusion_coefficient', ReadDiskItem( 'Apparent Diffusion Coefficient', 'Aims readable volume formats' ), 'fractional_anisotropy', ReadDiskItem( 'Fractional Anisotropy', 'Aims readable volume formats' ), 'volume_ratio', ReadDiskItem( 'Volume Ratio', 'Aims readable volume formats' ), 'standard_deviation', ReadDiskItem( 'Diffusion Standard Deviation', 'Aims readable volume formats' ), 'diffusion_weighted_t2', ReadDiskItem( 'Diffusion Weighted T2', 'Aims readable volume formats' ), 'statistics', WriteDiskItem( 'Bundles scalar features', 'Aims scalar features' ), ) def initialization( self ): self.linkParameters( 'statistics', 'bundles' ) self.setOptional( 'bundles_transformation' ) self.slices = 50 self.linkParameters( 'apparent_diffusion_coefficient', 'bundles' ) self.linkParameters( 'fractional_anisotropy', 'bundles' ) self.linkParameters( 'volume_ratio', 'bundles' ) self.linkParameters( 'standard_deviation', 'bundles' ) self.linkParameters( 'diffusion_weighted_t2', 'bundles' ) self.setOptional( 'minimum_length', 'slices', 'apparent_diffusion_coefficient', 'fractional_anisotropy', 'volume_ratio', 'standard_deviation', 'diffusion_weighted_t2' ) def execution( self, context ): command = [ 'comistBundleAnalysis_old', '--verbose', '-i', self.bundles, '-o', self.statistics, ] if self.bundles_transformation is not None: command += [ '-t', self.bundles_transformation ] if self.minimum_length > 0: command += [ '--minimumLength', self.minimum_length ] imageStatistics = [] if self.slices > 0: command += [ '--slices', self.slices ] if self.apparent_diffusion_coefficient is not None: imageStatistics += [ 'adc:' + self.apparent_diffusion_coefficient.fullPath() ] if self.fractional_anisotropy is not None: imageStatistics += [ 'fa:' + self.fractional_anisotropy.fullPath() ] if self.volume_ratio is not None: imageStatistics += [ 'vr:' + self.volume_ratio.fullPath() ] if self.standard_deviation is not None: imageStatistics += [ 'stddev:' + self.standard_deviation.fullPath() ] if self.diffusion_weighted_t2 is not None: imageStatistics += [ 'dwt2:' + self.diffusion_weighted_t2.fullPath() ] if imageStatistics: command += [ '--imageStatistics' ] + imageStatistics context.system( *command )